<?php

// 获取我的项目
// GET project.me

namespace app\api\resource\project;
use think\Db;
use think\Session;

class Me
{
    // 方法
    public $_method = ['GET'];
    // 前置
    public $_pre    = ['login','isCyz'];
    // 描述
    public $_description = '获取我的项目';
    // 参数
    public $_param  = [
        'model' => '模式,0-全部(默认)|1-未估值,2-已估值',
    ];
    // 返回
    public $_return = [
        200 => '获取成功',
    ];

    public function run(&$request)
    {
        $model    = $request->get('model/d',0);
        $memberId = Session::get('member.id');
        
        $where['member_id'] = $memberId;
        if (1 == $model) {
            $where['is_cp'] = 0;
        } elseif (2 == $model) {
            $where['is_cp'] = 1;
        }
        $where['delete_time'] = 0;
        $list = Db::name('project')->where($where)->select();

        return [200,$list];
    }
}